﻿using System;
using System.Globalization;
using System.IO;
using System.Windows.Forms;

namespace DataProcesses
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void buttonGetDataTrainTest_Click(object sender, EventArgs e)
        {
            folderData.ShowDialog();
        }

        private void buttonGetDataVector_Click(object sender, EventArgs e)
        {
            openFileLink.ShowDialog();
            var filedatavector = openFileLink.FileName.Substring(0,openFileLink.FileName.LastIndexOf('.'))+".vector";
            TextKetQua.Text += "\n" + openFileLink.FileName;
            TextKetQua.Text += "\n" + filedatavector;
            var sr = new StreamReader(openFileLink.FileName);
            var sw = new StreamWriter(filedatavector);
            while ((sr.ReadLine())!=null)
            {
                
            
                var title = sr.ReadLine();
                var html = sr.ReadLine();
                var nodecontent = sr.ReadLine();
                var xpath = sr.ReadLine();
                if (nodecontent != null) sw.WriteLine(nodecontent.Length.ToString(CultureInfo.InvariantCulture));
            }
            MessageBox.Show(@"Get data vector OK!");

        }

        private void buttonTraining_Click(object sender, EventArgs e)
        {
            openFileTrain.ShowDialog();
            TextKetQua.Text = openFileTrain.FileName;
        }
    }
}
